package fire.skill;

import fire.combat.CombatPet;
import fire.combat.EnemyTurn;

public class FireBall extends Skill {

	private CombatPet target;
	private int damage;
	private boolean use = false;

	public FireBall(double x, double y, CombatPet enemy, int damage) {
		super("fire", true, x, y, 666, "fire");
		expiry = expire_off_view;
		this.target = enemy;
		this.damage = damage;
		setSpeed(10);
		if (x < target.x) {
			setDir(1, 0);
		} else {
			setDir(-1, 0);
		}
	}

	@Override
	public void move() {
		if (checkCollision(target.colid, 0, 0) == target.colid && !use) {
			target.beHit(damage);
			use = true;
			if (target.colid == 777) {
				new EnemyTurn(target, 888, 30);
			}
			remove();
		}
	}
}
